package com.springboot.base.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.springboot.base.request.RegisterReq;
import com.springboot.base.request.UserLoginReq;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * <p>
 * </p>
 *
 * @author jobob
 * @since 2020-07-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    private Date createdAt;

    private Date updatedAt;

    private String telphone;

    private String password;

    private String nickName;

    private Integer gender;

    public User(Integer id, Date createdAt, Date updatedAt, String telphone, String password, String nickName, Integer gender) {
        this.id = id;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
        this.telphone = telphone;
        this.password = password;
        this.nickName = nickName;
        this.gender = gender;
    }

    public User(RegisterReq registerReq) {
        super();
        this.setNickName(registerReq.getNickName());
        this.setPassword(registerReq.getPassword());
        this.setGender(registerReq.getGender());
        this.setTelphone(registerReq.getTelphone());
    }

    public User(UserLoginReq loginReq){
        super();
        this.telphone = loginReq.getTelphone();
        this.password = loginReq.getPassword();
    }
}
